package io.wongxd.demo.page

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import io.wongxd.solution.baseView.BaseComposeToolBarFgt
import io.wongxd.solution.compose.composeTheme.AppThemeHolder
import io.wongxd.solution.compose.composeTheme.appColor
import io.wongxd.solution.compose.composeTheme.textStyle
import io.wongxd.solution.compose.custom.WPickerColumn
import io.wongxd.solution.compose.custom.views.other.FpsText

class FgtSimplePicker : BaseComposeToolBarFgt() {
    override fun lazyInit() {

    }

    override val title: String
        get() = "FgtSimplePicker"

    @Composable
    override fun Render() {
        Column(Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally) {

            val s = remember {
                mutableStateOf(0)
            }

            Text(
                text = s.value.toString(),
                style = AppThemeHolder.textStyle.sp16.appColor(),
                modifier = Modifier
                    .align(Alignment.CenterHorizontally)
                    .padding(30.dp)
            )

            WPickerColumn(
                list = (1..60).toList(),
                itemHeight = 60.dp,
                itemWidth = 80.dp,
                valueState = s
            ) { item, selected ->

                Box(
                    Modifier
                        .height(60.dp)
                        .width(80.dp)
                        .background(if (selected) Color.Green else Color.Red),
                    contentAlignment = Alignment.Center
                ) {

                    Text(text = "${item}", style = AppThemeHolder.textStyle.sp14)

                }
            }


            FpsText()

        }
    }

}